﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using System.Reflection;

namespace Baubixinh_client
{
    public partial class frmReportQty : DevExpress.XtraEditors.XtraForm
    {
        public DataTable ReportData { get; set; }

        public frmReportQty()
        {
            InitializeComponent();
        }

        private void frmReportQty_Load(object sender, EventArgs e)
        {
            try
            {
                //load kho hang
                clsCommon.fncLoadRadioKhoHang(rdKhoHang);
            }
            catch (Exception ex) { clsCommon.fncMsgError(MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, ex.Message); }
        }

        private void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                Cursor.Current = Cursors.WaitCursor;

                string strSearch = "";
                int intKhoID = -1;
                int intHienThi = -1;

                intKhoID = clsCommon.fncCnvNullToInt(rdKhoHang.EditValue);
                intHienThi = clsCommon.fncCnvNullToInt(rdHienThi.EditValue);

                DataTable objData = clsDbAccess.fncBaoCaoSoLuong(Program.gobjDb, "", strSearch, intHienThi, intKhoID);

                if (objData == null)
                {
                    clsCommon.fncMsgInfo("Không có dữ liệu.");
                    return;
                }

                this.ReportData = objData;
                this.Close();
            }
            catch (Exception ex) { clsCommon.fncMsgError(MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, ex.Message); }
            finally { Cursor.Current = Cursors.Default; }
        }

    }
}